export default {
  state: {
    count: 10000,
    msg: 'hello world',
    list: [
      {
        id: '123',
        title: 'hello'
      },
      {
        id: '234',
        title: 'world'
      },
      {
        id: '567',
        title: 'hhh'
      }
    ]
  },
  getters: {
    getMsg(state) {
      return state.msg.split('').reverse().join('')
    }
  },
  mutations: {
    SET_COUNT(state, payload) {
      state.count += 1
    },
    PUSH_ITEM_TO_LIST(state, payload) {
      // console.log(payload)
      state.list.push(payload)
    }
  },
  actions: {
    setList({commit}, data) {

      // console.log(data)
      commit('PUSH_ITEM_TO_LIST', data)
      commit('SET_COUNT')
    }
  },
  namespaced: true,
}


